<include file="../Public/header" />
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/plug/editor/kindeditor.js"></script>
<script type="text/javascript">
	$(
		function(){
			doChange();
			
			$("#type").change(
				function(){
					
					doChange();
				}
			
			);
		}
	);
	function doChange(){
		//根据选择的内容模型加载分类
		
		var typeval =  $("#type").val();
		$.get(
			"__URL__/getCats/type/"+typeval,
			function(data){
				var dataObj=eval("("+data+")"); //转换为json对象 
				$('#cathtml').html(dataObj.cat);
				
				//初始化编辑器
          KE.init({
              id : 'content',
              width : dataObj.model,
              height : '300px',
              resizeMode :1
          });
          
          var textarea = document.createElement('textarea');
          textarea.id = "content";
          textarea.name = "content";
          $('#cedit').html(textarea);
          //创建编辑器
          KE.create('content');
          
			}
		);
		
	}
</script>
<div class="main" >
	<div id="navigation"> &nbsp;当前位置 > 内容管理 > 添加内容</div>
	<div class="mainmenu"><a href="__URL__/catList"> < 返 回</a></div>
	<form id="contentForm" action="__URL__/doAddContent" method="post" enctype="multipart/form-data">
	<table id="mainform">
		<tr>
			<th width="80">参数说明</th><th>参数值</th>
		</tr>
		<tr>
			<td>内容模型: </td>
			<td>
				<select name="type" id="type">
					<volist name="models" id="vo">	
						<option value="{$vo.tablename}">{$vo.name}</option>
					</volist>
				</select>
			</td>
		</tr>
		<tr>
			<td>栏   目: </td>
			<td id="cathtml">
				<select name="cat" id="cat">
					<option value="0">请先选择内容模型</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>标   题: </td><td><input type="text" id="title" name="title" value="" /></td>
		</tr>
		<tr>
			<td>来   源: </td><td><input type="text" id="source" name="source" value="" /></td>
		</tr>
		<tr>
			<td>作   者: </td><td><input type="text" id="author" name="author" value="" /></td>
		</tr>
		<tr>
			<td>点击数: </td><td><input type="text" id="num" name="num" value="0" />填0系统将按照内容模型设置随机取值</td>
		</tr>
		<tr>
			<td>标   志: </td>
			<td>
				<div class="radio">
					<input type="checkbox" id="istop" name="istop" value="1"/><label for="istop">置顶</label>
					<input type="checkbox" id="isrecom" name="isrecom" value="1"/><label for="isrecom">推荐</label>
					<input type="checkbox" id="isimg" name="isimg" value="1"/><label for="isimg">图片</label>
				</div>
			</td>
		</tr>
		<tr>
			<td>缩略图: </td><td><input type="file" id="img" name="img" value="{$width}" /></td>
		</tr>
		<tr>
			<td>关键字: </td><td><input type="text" id="keyword" name="keyword" value="" /></td>
		</tr>
		<tr>
			<td>描     述: </td><td><textarea name="info" id="info" rows="3" cols="50"></textarea></td>
		</tr>
  </table>
  <table class="mainform">
  		<tr>
  			<td width="80" class="sj2em">内    容:</td><td class="sj2em"><div id="cedit"></div></td>
  		</tr>
  </table>
  <div class="mainmenu"><input type="submit" value="确 定"/>&nbsp;&nbsp;<input type="reset" value="重 置"/></div>
  </form>
</div>
 